package com.dao;


import com.domain.Comment;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("commentDao")
public interface CommentDao {

    Comment selectCommentById(int id);

    List<Comment> selectCommentByDiscussId(int discuss_id);

    List<Comment> selectCommentByContributeId(Integer contribute_id);

    int selectCommentTotalByDiscussId(int discuss_id);

    int selectCommentTotalByContributeId(Integer contribute_id);

    int addComment(Comment comment);

    int deleteCommentById(int id);

    List<Comment> selectCommentAndPageLimitById(@Param("discuss_id")int discuss_id,@Param("from") int page, @Param("pageSize") int pageSize);

    List<Comment> selectContributeCommentAndPageLimitById(@Param("contribute_id")int contribute_id,@Param("from") int page, @Param("pageSize") int pageSize);


    //根据资源id显示评论信息
     List<Comment> showCommentByResourceId(@Param("id")Integer id);

    //根据评论id显示评论信息
     List showCommentById(@Param("id")Integer id);


    //根据资源id分页显示评论信息
     List<Comment> selectResourceCommentAndPageLimitById(@Param("resource_id")int resource_id,@Param("from") int page, @Param("pageSize") int pageSize);

    //添加评论信息
     int addResourceComment(Comment comment);

}
